<template>
  <el-menu
    :default-active="$route.path"
    background-color="#545c64"
    class="el-menu-vertical-demo"
    active-text-color="#ffd04b" router
    text-color="#fff">
    <el-menu-item index="/JiraView">
       <i class="el-icon-user-solid"></i>
      <span>个人需求面板</span>
    </el-menu-item>

     <el-menu-item index="/ToolsTodoPage">
        <i class="el-icon-s-opportunity"></i>
        <span>发布任务待办</span>
    </el-menu-item>

    <el-menu-item index="/ToolsAutoCreatePage" v-if="typeId!=='PM'">
        <i class="el-icon-takeaway-box"></i>
        <span>自动化触发</span>
    </el-menu-item>

    <el-menu-item index="/ScpProjectListView" v-if="typeId!=='PM'">
        <i class="el-icon-paperclip"></i>
        <span>代码覆盖率</span>
    </el-menu-item>

     <el-menu-item index="/BugView" v-if="typeId==='QA'">
       <i class="el-icon-user-solid"></i>
      <span>未处理Bug</span>
    </el-menu-item>

     <el-menu-item index="/CoverageView" v-if="typeId==='QA'">
        <i class="el-icon-s-goods"></i>
        <span>接口覆盖率统计</span>
    </el-menu-item>

    <!-- <el-menu-item index="/QueryDbView">
        <i class="el-icon-s-data"></i>
        <span>Query DB data</span>
    </el-menu-item> -->

    <el-submenu index="0">
      <template slot="title">
        <i class="el-icon-s-custom"></i>
        <span>公共小工具</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/CreateAccountView">
          <i class="el-icon-paperclip"></i>Create new ccount
        </el-menu-item>
        <el-menu-item index="/QueryRedisView">
          <i class="el-icon-takeaway-box"></i>Query Redis data
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="1">
      <template slot="title">
        <i class="el-icon-menu"></i>
        <span>CRM小工具</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/CreateMktActivityView">
          <i class="el-icon-paperclip"></i>Create mkt activity
        </el-menu-item>
        <el-menu-item index="/RewardPenaltyView">
          <i class="el-icon-takeaway-box"></i>CRM reward and penalty
        </el-menu-item>
        <el-menu-item index="/ChangequtoaView">
          <i class="el-icon-attract"></i>Change CRM quota
        </el-menu-item>
        <el-menu-item index="/MockUDPView">
          <i class="el-icon-attract"></i>Mock UDP data
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="2">
      <template slot="title">
        <i class="el-icon-s-tools"></i>
        <span>MBS小工具</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/AddPointView">
          <i class="el-icon-paperclip"></i>Mock order add points
        </el-menu-item>
        <el-menu-item index="/QueryMapPointView">
          <i class="el-icon-takeaway-box"></i>Query point map
        </el-menu-item>
        <el-menu-item index="/RefreshTimingTaskView">
          <i class="el-icon-attract"></i>Refresh timing task
        </el-menu-item>
        <el-menu-item index="/MembershipToolsPage">
          <i class="el-icon-s-custom"></i>Membership Tools
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="3">
      <template slot="title">
        <i class="el-icon-s-tools"></i>
        <span>代码扫描</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/CAPView">
          <i class="el-icon-paperclip"></i>个人面板
        </el-menu-item>
        <el-menu-item index="/MasterCAPView">
          <i class="el-icon-takeaway-box"></i>master面板
        </el-menu-item>
      </el-menu-item-group>
    </el-submenu>
<!--    <el-menu-item index="/CAPView" v-if="typeId!=='PM'">-->
<!--        <i class="el-icon-takeaway-box"></i>-->
<!--        <span>代码扫描</span>-->
<!--    </el-menu-item>-->
    <el-menu-item index="/JiraCornView">
        <i class="el-icon-paperclip"></i>
        <span>Jira定时配置</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
  import {api, getRequest, postRequest} from "@/api/commit";

    export default {
      name : "AsideBar",
      data() {
        return {
          typeId:"QA",
          Permission: true,
        }
      },
      methods: {
        init_data() {
          getRequest(api['permission_user']).then((res) => {
            res = res.resultReturn
            if (res.data.length===0){
              this.Permission = true
            }else{
              this.Permission = false
            }
          }, (error) => {
            console.info(error)
            this.Permission = true
          })
        },
        init_select() {
              var typeId=this.$cookies.get('typeId')
              // // console.log(projectId)
              if(typeId!==null){
                  this.typeId=typeId
              }
        }
      },
      // created () {
      //   // this.init_data()
      // },
      mounted () {
        this.init_select()
      }
    }
</script>

<style scoped>

</style>
